﻿using AutoMapper;
using D.Medicalcare.Domain.Entities;
using D.Medicalcare.ErrorCode;
using D.Medicalcare.Read.API.Application.Command.RefundCommand;
using D.Medicalcare.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace D.Medicalcare.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RefundController : ControllerBase
    {

        private readonly IMediator mediator;

        public RefundController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 退款记录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<RefundDto>> GetRefund([FromQuery]GetRefundCommand request)
        {

            return await mediator.Send(request);

        }

        /// <summary>
        /// 退款详情
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<RefundDto>> FtRefund([FromQuery]FtRefundCommand request)
        {
            return await mediator.Send(request);
        }


        /// <summary>
        /// 查询余额
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<Accountbalance>> Accountbalance([FromQuery]GetAccountbalanceCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }


        }
    }
